/*
 * freq.c
 *
 *  Created on: 2016-4-23
 *      Author: Billli
 */

#include "freq.h"

double GetFreq(void){
	double freq;
	alt_u32 freq_0,freq_1;
	freq_0=BUS_RD(FREQ_CS,FREQ_0_OFFSET);
	printf("freq0=%ld\t",freq_0);
	freq_1=BUS_RD(FREQ_CS,FREQ_1_OFFSET);
	printf("freq0=%ld\t",freq_1);
	freq=1.0*freq_0/freq_1 *CPU_FREQ;
	return freq;
}


